package com.wuba.rxjavademo.tzx.filter;

import com.wuba.rxjavademo.tzx.common.Base;

/**
 * Created by tanzhenxing
 * Date: 2016/6/27.
 * Description:
 * skip(n)创建一个不发射前n个元素而是发射它后面的那些数据的序列
 * skipLast(n)创建一个不发射后n个元素而是发射它前面的那些数据的序列
 */
public class RxSkipOrSkipLast extends Base {
    public static void main(String[] args) {
        RxSkipOrSkipLast skipOrSkipLast = new RxSkipOrSkipLast();
        skipOrSkipLast.run();
    }

    @Override
    public void run() {
        getObservable()
                .skip(2)
                .subscribe(num -> print(num, "skip:"));
        getObservable()
                .skipLast(2)
                .subscribe(num -> print(num, "skipLast:"));
    }
}
